
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TTQT.UserControl
{
	/// <summary>
	///		Summary description for Banner.
	/// </summary>
	public partial class Banner : MasterControl// System.Web.UI.UserControl
	{
		public string sDate="";
		public string UID
		{
			get
			{
				if(Session["UserName"] !=null)
				{
					return Session["UserName"].ToString();
				}
				else
				{
					return "Guest";
				}
			}
		}

		protected void Page_Load(object sender, System.EventArgs e)
		{
			if(!Page.IsPostBack)
			{
				lnkThoat.Attributes.Add("onclick", "javascript:return confirm(' Ban co chac chan muon thoat? ');");
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}
		#endregion

		protected void lnkThoat_Click(object sender, System.EventArgs e)
		{
			try
			{	
				//Write a logout log into Log Table
				TTQT.TTQT_Code.Info.LogInfo obj_log =
				new TTQT_Code.Info.LogInfo(Request.UserHostAddress, userName, "Log out","Thoát khỏi hệ thống", "", this.brnCode);
				TTQT.TTQT_Code.DataAccessObject.instance().addLog(obj_log);
			}
			catch(Exception ex)
			{
				
			}
			Session.Clear();
			Response.Redirect("Default.aspx");
		}
	}
}
